package com.gemptc.daoimp;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.gemptc.dao.IUpdate;
import com.gemptc.utils.DBUtil;
import com.gemptc.utils.MD5Tool;

public class UpdateImp implements IUpdate {

	@Override
	public boolean update(String user_password,String user_name) {
		boolean flag=false;
		PreparedStatement preparedStatement=null;
		Connection connection=DBUtil.getConnection();
		String sql = "update users set user_password=?where user_name=?";
		try {
			preparedStatement=connection.prepareStatement(sql);
			
			preparedStatement.setString(1, MD5Tool.MD5(user_password));
			preparedStatement.setString(2, user_name);
			preparedStatement.execute();
			flag=true;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;
	}

}
